package server;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;

/**
 * @author yangpeng
 * @time 2020/4/2
 * @since 1.0.0
 */
public class Host {

    private String name;

    private String appBase;

    private String host;

    private Integer port;

    private Context context;

    private Map<String,String> staticHtmlMapping = new HashMap<>();

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public void initContext() throws FileNotFoundException {
        File file = new File(appBase);
        this.context = new Context();
        this.context.loadWebApp(appBase);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAppBase() {
        return appBase;
    }

    public void setAppBase(String appBase) {
        this.appBase = appBase;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }
}
